import  { useState } from 'react'
import axios from 'axios'
import { InfiniteScroll } from 'antd-mobile'
const  App=()=>{
const [list,setList]=useState([])
const [pageCode,setPageCode]=useState(1)

const date=async()=>{
  let req=await axios.get('/api/room/list',{params:{pageCode}})
  console.log(req)
  const newList=req.data.data.list
  setList(list.concat(newList))
  setPageCode(pageCode+1)
}
  return (
    <div>
 <h1>这是一个函数组件 </h1>
 {
        list.map((v)=>{
          <dl>
            <dt key={v.id}>
      <img src={v.url} alt="" />
            </dt>
            <dd>
              <h1>{v.title}</h1>
            </dd>
          </dl>
          
        })
       
      }
       <InfiniteScroll loadMore={date} hasMore={true} />
    </div>
   
   
  )
  
}

export default App